/*
描述：路由配置文件，定义项目所有页面路由规则和组件映射关系
完成人：何艺珲
完成时间: 2025/04/24
*/



// 创建一个路由器，并暴露出去
// 第一步：引入createRouter
import {createRouter,createWebHistory} from 'vue-router'
// 引入一个一个可能要呈现组件
import HomeView from '@/views/HomeView.vue';
import LoginView from '@/views/LoginView.vue';
import RegisterView from '@/views/RegisterView.vue';
import UserView from '@/views/UserView.vue';
import QuestionDetailView from '@/views/QuestionDetailView.vue';
import SearchView from '@/views/SearchView.vue';
import TagQuestionsView from '@/views/TagQuestionsView.vue';
import PublishQuestionView from '@/views/PublishQuestionView.vue';
import UserProfileEditView from '@/views/User/UserProfileEditView.vue';
import MyQuestionsView from '@/views/User/MyQuestionsView.vue';
import MyAnswersView from '@/views/User/MyAnswersView.vue';
import MyLikesView from '@/views/User/MyLikesView.vue';

// 第二步：创建路由器
const router = createRouter({
    history:createWebHistory(), //路由器的工作模式（稍后讲解）
    routes:[ //一个一个的路由规则
        {
            name:'Home',
            path:'/home',
            component:HomeView,
            meta:{
                isShow:true
            }
        },
        {
            name:'Login',
            path:'/login',
            component:LoginView
        },
        {
            name:'Register',
            path:'/register',
            component:RegisterView
        },
        {
            name:'User',
            path:'/user',
            component:UserView
        },
        {
            name:'QuestionDetail',
            path:'/question',
            component:QuestionDetailView
        },
        {
            name:'Search',
            path:'/search',
            component:SearchView
        },
        {
            name:'TagQuestions',
            path:'/tag/:tag',
            component:TagQuestionsView
        },
        {
            name:'PublishQuestion',
            path:'/publish-question',
            component:PublishQuestionView
        },
        {
            name:'UserProfileEdit',
            path:'/user/profile-edit',
            component:UserProfileEditView
        },
        {
            name:'MyQuestions',
            path:'/user/my-questions',
            component:MyQuestionsView
        },
        {
            name:'MyAnswers',
            path:'/user/my-answers',
            component:MyAnswersView
        },
        {
            name:'MyLikes',
            path:'/user/my-likes',
            component:MyLikesView
        },
        {
            path:'/',
            redirect:'/home'
        }
    ]
})

// 暴露出去router
export default router
